package com.bckj.fastboot.upms.biz.repository;

import com.bckj.fastboot.upms.biz.mapper.SysUserRoleMapper;
import com.bckj.fastboot.upms.api.entity.SysUserRole;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 用户_角色关联表(SysUserRole)表服务实现类
 *
 * @author wfc
 * @since 2023-09-14 10:14:36
 */
@Repository
public class SysUserRoleRepository 
        extends ServiceImpl<SysUserRoleMapper, SysUserRole>  {

    public List<Long> getUserRoleIds(Long userId) {
        return lambdaQuery()
                .eq(SysUserRole::getUserId, userId)
                .select(SysUserRole::getRoleId)
                .list().stream().map(SysUserRole::getRoleId).collect(Collectors.toList());
    }
}

